package com.rubiksillusions;

public class RubiksCubeConditionalExecuteTest {
	public static void main(String[] args) {
		System.out.println("INIZIO");
		String solvedFacelets = "wwwwwwwwwyyyyyyyyyooooooooobbbbbbbbbrrrrrrrrrggggggggg";
		RubiksCube rubiksCube = new RubiksCube(solvedFacelets);
		
		boolean result = rubiksCube.executeConditionalMovesList(
				"...a..................................................",
				"......................................................", "R", true);
		
		System.out.println(result);
		
		
		/* TEST */
		rubiksCube = new RubiksCube(solvedFacelets);
		rubiksCube.executeMovesList("F'", true);
		System.out.println(rubiksCube.getFaceletsString());
		
		result = rubiksCube.executeConditionalMovesList(
				"wwwwwwwwwyyyyyyyyyooooooooobbbbbbbbbrrrrrrrrrggggggggg",
				"rrrwwwwwwgyygyygyyooooooooobbbbbbbbbyrryrryrrwwwgggggg",
				"F", true);
		
		System.out.println("TEST (true): " + result);
		System.out.println(rubiksCube.getFaceletsString());
		
		
		// Calcolo le mosse finali.
		
		System.out.println("FINALI");
		int counter = 0;
		
		for (int i = 0; i < 6; i++) {
			String move = getMove(i);
			
			System.out.println(++counter + " " + solvedFacelets + " " + rubiksCube.getFaceletsString() + " " + move);
			rubiksCube.executeMovesList(move, true);
		}
		/*
		for (int i = 0; i < 6; i++) {
			String move1 = getMove(i);
			for (int j = 0; j < 6; j++) {
				String move2 = getMove(j);
				rubiksCube.executeMovesList(move1 + " " + move2, true);
				System.out.println(++counter + " " + solvedFacelets + " " + rubiksCube.getFaceletsString() + " " + move1 + " " + move2);
			}
		}
		
		for (int i = 0; i < 6; i++) {
			String move1 = getMove(i);
			for (int j = 0; j < 6; j++) {
				String move2 = getMove(j);
				for (int k = 0; k < 6; k++) {
					String move3 = getMove(k);
					rubiksCube.executeMovesList(move1 + " " + move2 + " " + move3, true);
					System.out.println(++counter + " " + solvedFacelets + " " + rubiksCube.getFaceletsString() + " " + move1 + " " + move2 + " " + move3);
				}
			}
		}
		
		for (int i = 0; i < 6; i++) {
			String move1 = getMove(i);
			for (int j = 0; j < 6; j++) {
				String move2 = getMove(j);
				for (int k = 0; k < 6; k++) {
					String move3 = getMove(k);
					for (int s = 0; s < 6; s++) {
						String move4 = getMove(s);
						rubiksCube.executeMovesList(move1 + " " + move2 + " " + move3 + " " + move4, true);
						System.out.println(++counter + " " + solvedFacelets + " " + rubiksCube.getFaceletsString() + " " + move1 + " " + move2 + " " + move3 + " " + move4);
					}
				}
			}
		}
		*/
	}
	
	private static String getMove(int moveNumber) {
		switch (moveNumber) {
			case 0: return "F";
			case 1: return "B";
			case 2: return "R";
			case 3: return "L";
			case 4: return "U";
			case 5: return "D";
		}
		return "";
	}
}
